﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Server.Model;
using Server.Biz;

namespace ServerWeb
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ParentInfo parent = new ParentInfo();
            parent.UserName = this.txtUserName.Text;
            parent.Password = this.txtPwd.Text;
            parent.Email = this.txtEmail.Text;
            ClientInfo client1 = new ClientInfo();
            client1.ClientName = this.txtClient1Name.Text;
            client1.Password = this.txtClient1Password.Text;
            parent.Clients.Add(client1);

            ClientInfo client2 = new ClientInfo();
            client2.ClientName = this.txtClient2Name.Text;
            client2.Password = this.txtClient2Password.Text;
            parent.Clients.Add(client2);

            UserService svc = new UserService();
            svc.CreateUser(parent, null, null);

            Response.Redirect("Home");
        }
    }
}